package protagonist.common.util;

import javax.servlet.http.HttpServletRequest;

public class IPAddressUtil {

    public static String getClientIpAddress(HttpServletRequest request) {
        String ipAddress = request.getHeader("X-Forwarded-For");
        if (ipAddress == null || ipAddress.isEmpty() || "unknown".equalsIgnoreCase(ipAddress)) {
            ipAddress = request.getHeader("Remote-Addr");
        }
        return ipAddress;
    }
}
